package aigle.idm.diagraph.tp3.diagram_default_root.part;

import java.util.Collections;
import java.util.List;

import org.eclipse.gef.Tool;
import org.eclipse.gef.palette.PaletteContainer;
import org.eclipse.gef.palette.PaletteGroup;
import org.eclipse.gef.palette.PaletteRoot;
import org.eclipse.gef.palette.PaletteSeparator;
import org.eclipse.gef.palette.ToolEntry;
import org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeConnectionTool;
import org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeCreationTool;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;

/**
 * @generated
 */
public class Tp3PaletteFactory {

	/**
	 * @generated
	 */
	public void fillPalette(PaletteRoot paletteRoot) {
		paletteRoot.add(createDefault1Group());
	}

	/**
	 * Creates "default" palette tool group
	 * @generated
	 */
	private PaletteContainer createDefault1Group() {
		PaletteGroup paletteContainer = new PaletteGroup(
				aigle.idm.diagraph.tp3.diagram_default_root.part.Messages.Default1Group_title);
		paletteContainer.setId("createDefault1Group"); //$NON-NLS-1$
		paletteContainer.add(new PaletteSeparator());
		paletteContainer.add(createRecette2CreationTool());
		paletteContainer.add(createIngredient3CreationTool());
		paletteContainer.add(createVin4CreationTool());
		paletteContainer.add(createLocalisation5CreationTool());
		paletteContainer.add(new PaletteSeparator());
		paletteContainer.add(createBouteille7CreationTool());
		paletteContainer.add(new PaletteSeparator());
		paletteContainer.add(createCompose9CreationTool());
		paletteContainer.add(new PaletteSeparator());
		paletteContainer.add(createOrigineRegionale11CreationTool());
		return paletteContainer;
	}

	/**
	 * @generated
	 */
	private ToolEntry createRecette2CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				aigle.idm.diagraph.tp3.diagram_default_root.part.Messages.Recette2CreationTool_title,
				aigle.idm.diagraph.tp3.diagram_default_root.part.Messages.Recette2CreationTool_desc,
				Collections
						.singletonList(aigle.idm.diagraph.tp3.diagram_default_root.providers.Tp3ElementTypes.Recette_1001));
		entry.setId("createRecette2CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(aigle.idm.diagraph.tp3.diagram_default_root.part.Tp3DiagramEditorPlugin
				.findImageDescriptor("/aigle.idm.diagraph.tp3/icons/Recette.gif")); //$NON-NLS-1$
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createIngredient3CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				aigle.idm.diagraph.tp3.diagram_default_root.part.Messages.Ingredient3CreationTool_title,
				aigle.idm.diagraph.tp3.diagram_default_root.part.Messages.Ingredient3CreationTool_desc,
				Collections
						.singletonList(aigle.idm.diagraph.tp3.diagram_default_root.providers.Tp3ElementTypes.Ingredient_1002));
		entry.setId("createIngredient3CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(aigle.idm.diagraph.tp3.diagram_default_root.part.Tp3DiagramEditorPlugin
				.findImageDescriptor("/aigle.idm.diagraph.tp3/icons/Ingredient.gif")); //$NON-NLS-1$
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createVin4CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				aigle.idm.diagraph.tp3.diagram_default_root.part.Messages.Vin4CreationTool_title,
				aigle.idm.diagraph.tp3.diagram_default_root.part.Messages.Vin4CreationTool_desc,
				Collections
						.singletonList(aigle.idm.diagraph.tp3.diagram_default_root.providers.Tp3ElementTypes.Vin_1003));
		entry.setId("createVin4CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(aigle.idm.diagraph.tp3.diagram_default_root.part.Tp3DiagramEditorPlugin
				.findImageDescriptor("/aigle.idm.diagraph.tp3/icons/Vin.gif")); //$NON-NLS-1$
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createLocalisation5CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				aigle.idm.diagraph.tp3.diagram_default_root.part.Messages.Localisation5CreationTool_title,
				aigle.idm.diagraph.tp3.diagram_default_root.part.Messages.Localisation5CreationTool_desc,
				Collections
						.singletonList(aigle.idm.diagraph.tp3.diagram_default_root.providers.Tp3ElementTypes.Localisation_1004));
		entry.setId("createLocalisation5CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(aigle.idm.diagraph.tp3.diagram_default_root.part.Tp3DiagramEditorPlugin
				.findImageDescriptor("/aigle.idm.diagraph.tp3/icons/Localisation.gif")); //$NON-NLS-1$
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createBouteille7CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				aigle.idm.diagraph.tp3.diagram_default_root.part.Messages.Bouteille7CreationTool_title,
				aigle.idm.diagraph.tp3.diagram_default_root.part.Messages.Bouteille7CreationTool_desc,
				Collections
						.singletonList(aigle.idm.diagraph.tp3.diagram_default_root.providers.Tp3ElementTypes.Bouteille_2001));
		entry.setId("createBouteille7CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(aigle.idm.diagraph.tp3.diagram_default_root.part.Tp3DiagramEditorPlugin
				.findImageDescriptor("/aigle.idm.diagraph.tp3/icons/Bouteille.gif")); //$NON-NLS-1$
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createCompose9CreationTool() {
		LinkToolEntry entry = new LinkToolEntry(
				aigle.idm.diagraph.tp3.diagram_default_root.part.Messages.Compose9CreationTool_title,
				aigle.idm.diagraph.tp3.diagram_default_root.part.Messages.Compose9CreationTool_desc,
				Collections
						.singletonList(aigle.idm.diagraph.tp3.diagram_default_root.providers.Tp3ElementTypes.Compose_3001));
		entry.setId("createCompose9CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(aigle.idm.diagraph.tp3.diagram_default_root.part.Tp3DiagramEditorPlugin
				.findImageDescriptor("/aigle.idm.diagraph.tp3/icons/Compose.gif")); //$NON-NLS-1$
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createOrigineRegionale11CreationTool() {
		LinkToolEntry entry = new LinkToolEntry(
				aigle.idm.diagraph.tp3.diagram_default_root.part.Messages.OrigineRegionale11CreationTool_title,
				aigle.idm.diagraph.tp3.diagram_default_root.part.Messages.OrigineRegionale11CreationTool_desc,
				Collections
						.singletonList(aigle.idm.diagraph.tp3.diagram_default_root.providers.Tp3ElementTypes.RecetteOrigineRegionale_3002));
		entry.setId("createOrigineRegionale11CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(aigle.idm.diagraph.tp3.diagram_default_root.part.Tp3DiagramEditorPlugin
				.findImageDescriptor("/aigle.idm.diagraph.tp3/icons/origineRegionale.gif")); //$NON-NLS-1$
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private static class NodeToolEntry extends ToolEntry {

		/**
		 * @generated
		 */
		private final List<IElementType> elementTypes;

		/**
		 * @generated
		 */
		private NodeToolEntry(String title, String description,
				List<IElementType> elementTypes) {
			super(title, description, null, null);
			this.elementTypes = elementTypes;
		}

		/**
		 * @generated
		 */
		public Tool createTool() {
			Tool tool = new UnspecifiedTypeCreationTool(elementTypes);
			tool.setProperties(getToolProperties());
			return tool;
		}
	}

	/**
	 * @generated
	 */
	private static class LinkToolEntry extends ToolEntry {

		/**
		 * @generated
		 */
		private final List<IElementType> relationshipTypes;

		/**
		 * @generated
		 */
		private LinkToolEntry(String title, String description,
				List<IElementType> relationshipTypes) {
			super(title, description, null, null);
			this.relationshipTypes = relationshipTypes;
		}

		/**
		 * @generated
		 */
		public Tool createTool() {
			Tool tool = new UnspecifiedTypeConnectionTool(relationshipTypes);
			tool.setProperties(getToolProperties());
			return tool;
		}
	}
}
